import 'package:flutter/material.dart';

class FeedbackPage extends StatefulWidget {
  const FeedbackPage({Key? key}) : super(key: key);

  @override
  _FeedbackPageState createState() => _FeedbackPageState();
}

class _FeedbackPageState extends State<FeedbackPage> {
  TextEditingController _nameControllor = TextEditingController();
  TextEditingController _classControllor = TextEditingController();
  TextEditingController _elseControllor = TextEditingController();
  var _value;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    _nameControllor.dispose();
    _classControllor.dispose();
    _elseControllor.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: (AppBar(
        backgroundColor: Colors.blueGrey,
        title: Text(
          "意见反馈",
        ),
        centerTitle: true,
        elevation: 5.0,
      )),
      body: Padding(
        padding: EdgeInsets.fromLTRB(40, 0, 40, 0),
        child: Center(
          child: Container(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Flex(
                  mainAxisAlignment: MainAxisAlignment.center,
                  direction: Axis.horizontal,
                  children: [
                    Expanded(
                      flex: 6,
                      child: Text(
                        "选择条目名称：",
                        style: TextStyle(
                          fontSize: 20,
                          color: Colors.blueGrey.shade300,
                        ),
                      ),
                    ),
                    Expanded(
                      flex: 1,
                      child: SizedBox(
                          // height: 20,
                          ),
                    ),
                    Expanded(
                      flex: 8,
                      child: TextFormField(
                        controller: _nameControllor,
                        textInputAction: TextInputAction.next,
                        decoration: InputDecoration(
                          contentPadding: EdgeInsets.only(
                            left: 20,
                            top: 5,
                          ),
                          fillColor: Colors.blueGrey.shade300,
                          filled: true,
                          border: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(10),
                          ),
                        ),
                      ),
                    )
                  ],
                ),
                SizedBox(
                  height: 30,
                ),
                Flex(
                  mainAxisAlignment: MainAxisAlignment.center,
                  direction: Axis.horizontal,
                  children: [
                    Expanded(
                      flex: 6,
                      child: Text(
                        "反馈条目类别：",
                        style: TextStyle(
                          fontSize: 20,
                          color: Colors.blueGrey.shade300,
                        ),
                      ),
                    ),
                    Expanded(
                      flex: 1,
                      child: SizedBox(
                          // height: 20,
                          ),
                    ),
                    Expanded(
                      flex: 8,
                      child: DropdownButtonFormField(
                        value: _value,
                        items: [
                          DropdownMenuItem(
                              child: Text('可回收垃圾'), value: '可回收垃圾'),
                          DropdownMenuItem(child: Text('有害垃圾'), value: '有害垃圾'),
                          DropdownMenuItem(
                              child: Text('其他干垃圾'), value: '其他干垃圾'),
                          DropdownMenuItem(
                              child: Text('厨余湿垃圾'), value: '厨余湿垃圾'),
                        ],
                        onChanged: (value) {
                          setState(
                            () {
                              _value = value;
                            },
                          );
                        },
                        decoration: InputDecoration(
                          contentPadding: EdgeInsets.only(
                            left: 20,
                            top: 5,
                          ),
                          fillColor: Colors.blueGrey.shade300,
                          filled: true,
                          border: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(10),
                          ),
                        ),
                      ),
                    )
                  ],
                ),
                SizedBox(
                  height: 30,
                ),
                Text(
                  "备注：",
                  style: TextStyle(
                    fontSize: 20,
                    color: Colors.blueGrey.shade300,
                  ),
                ),
                SizedBox(
                  height: 10,
                ),
                TextFormField(
                  controller: _elseControllor,
                  textInputAction: TextInputAction.send,
                  decoration: InputDecoration(
                    contentPadding: EdgeInsets.only(
                      left: 20,
                      top: 5,
                    ),
                    fillColor: Colors.blueGrey.shade300,
                    filled: true,
                    border: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(10),
                    ),
                  ),
                ),
                SizedBox(
                  height: 30,
                ),
                OutlinedButton(
                  onPressed: () {
                    print(_nameControllor.text);
                    print(_value);
                    print(_elseControllor.text);

                    Navigator.of(context).pop();
                  },
                  child: Text(
                    "提交意见",
                    style: TextStyle(
                      color: Colors.blueGrey.shade300,
                      fontWeight: FontWeight.bold,
                      fontSize: 20,
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
